get_computed_values() with support for axis_ranges and axis_types (#5552)#5570
get_computed_values() with support for axis_ranges and axis_types (#5552)#5570Khanz9664 wants to merge 16 commits intoplotly:mainfrom
Conversation
Implements an initial version of get_computed_values() as proposed in plotly#5552. Supports retrieval of computed axis ranges (axis_ranges) using a lightweight interface built on top of full_figure_for_development(). Includes input validation, safe layout traversal, JSON-serializable outputs, and unit tests for basic, multi-axis, and edge case scenarios.
…nt the new feature.
Pr2 axis types
Pr2 axis types
|
Hi! This is my first contribution to the project. I noticed that the workflow is awaiting approval to run. Thank you! |
|
@Khanz9664 Done! Sorry for the inconvenience, we are migrating our CI pipelines at the moment and some settings may change for the next few weeks. You should be good to go for this PR. |
|
@emilykl Thank you for enabling the workflows and for the update! All checks are now passing. Please let me know if any changes are needed — I’d be happy to update the PR. Looking forward to your feedback! |
|
Hi @emilykl @camdecoster, all checks are passing now. I’d really appreciate a review when you have time. Happy to make any changes. Thanks! |
|
Hi @Khanz9664, thank you for your work on this feature! I had a discussion with @alexcjohnson last week who opened the linked issue, to better understand his use case and requirements of the feature. You can read the details in my comment here. One important conclusion is that I'm going to close this PR since a different approach is required, but please feel free to continue working on the feature if you like, given the new information. Happy to discuss more implementation details in the linked issue. |
Link to issue
#5552 - [FEATURE]: Access values calculated / derived by plotly.js as part of plotting
Closes #5552
Description of change
This PR introduces an initial implementation of
get_computed_values()to expose values computed by Plotly.js in a structured and programmatic way.The implementation supports retrieval of:
axis_ranges: The final computed [min, max] range for each axisaxis_types: The detected axis type (e.g., linear, log, date, category)Key aspects of this implementation:
full_figure_for_development()to return only requested computed valuesstartswithapproach to identify axis keys (e.g.,xaxis,yaxis,xaxis2)includeparameter and early return for empty inputDemo
Screencast.from.2026-04-15.21-39-03.webm
Testing strategy
Added a comprehensive test suite in tests/test_core/test_update_objects/test_get_computed_values.py:
Note: Tests use mocking for the Kaleido rendering engine to ensure environment-agnostic reliability during CI.
Additional information (optional)
This implementation establishes the API structure for accessing computed Plotly.js values and demonstrates its extensibility by supporting multiple properties (axis_ranges, axis_types) using a scalable single-pass design.
Future extensions could include:
Guidelines